import java.util.Scanner;

public class lenth {
    public static void t1(){
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入用户名：");
        String name = sc.next();
        System.out.print("请输入密码：");
        if (sc.next().length() >= 6){
            System.out.println("注册成功");
        }else {
            System.out.println("密码不能小于6位");
        }
    }

    public static void t2(){
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入用户名：");
        String name = sc.next();
        System.out.print("请输入密码：");
        String pwd = sc.next();
        String a = name.charAt(0) + "";
        String b = name.charAt(name.length()-1) + "";
        //if (name.indexOf('T') != 0 && name.lastIndexOf('M') != name.length()-1)
        if (!a.equals("T") || !b.equals("M"))
        {
            System.out.println("用户名错误");
        }else {
            if (pwd.equalsIgnoreCase("1234567")){
                System.out.println("登录成功！");
            }else {
                System.out.println("密码不匹配！");
            }
        }
    }

    public static void t3(){
        String str = "个.....人.信息.text";
        String[] page = {"jepg","bmg","png","jpg"};
        for (int i = 0; i < page.length; i++) {
            if (str.substring(str.lastIndexOf(".")+1).equals(page[i])){
                System.out.println("上传成功");
            }else{
                System.out.println("上传格式不对");
            }
        }
        System.out.println();
    }

    public static void t4(){
        System.out.println("=====欢迎进入注册系统=====");
        Scanner sc = new Scanner(System.in);
        do {
            System.out.print("请输入用户名");
            String a = sc.next();
            System.out.print("请输入密码");
            String b = sc.next();
            System.out.print("请再次输入密码");
            String c = sc.next();
            if (a.length() >= 3){
                if (b.length() >= 6){
                    if (b.equals(c)){
                        System.out.println("注册成功，请牢记密码");
                        break;
                    }else {
                        System.out.println("两次密码不一样");
                    }
                }else {
                    System.out.println("密码长度不能小于6位");
                }
            }else {
                System.out.println("用户名长度不能小于3位");
            }
        }while (true);
    }

    public static void t5(){
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入Java文件名：");
        String j = sc.next();
        System.out.print("请输入邮箱：");
        String email = sc.next();
        if (!j.endsWith(".java")){
            System.out.println("Java文件名有误");
        }
        if (email.lastIndexOf('@') != -1 || email.lastIndexOf('.') != -1){
            if (email.lastIndexOf('@') < email.lastIndexOf('.')){
                System.out.println("作业提交成功");
            }else {
                System.out.println("邮箱有误");
            }
        }else {
            System.out.println("邮箱有误");
        }
        System.out.println();
    }

    public static void t6(){
        System.out.println("原哥词");
        String str = "长亭外 古道边 芳草碧连天 晚风扶 柳笛声残 夕阳山外山";
        System.out.println(str);
        System.out.println("拆分后：");
        String[] s = str.split(" ");
        for (String s1 : s) {
            System.out.println(s1);
        }
    }

    public static void t7(){
        System.out.print("请输入字符串：");
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        String[] split = str.split("");
        System.out.print("请输入要查找得字符：");
        String a = sc.next();
        int num = 0;
        for (String aChar : split) {
            System.out.println("aChar = " + aChar);
            if (a.equals(aChar)){
                num += 1;
            }
        }

        System.out.println("\"" + str + "\"中包含" + num + "个"  + a + "字！");
    }

    public static void t8(){
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入字符串：");
        String s = sc.next();
        StringBuffer str = new StringBuffer(s);
        System.out.println(str);
        if (s.equals(str.reverse().toString())){
            System.out.println("是对称字符串");
        }else {
            System.out.println("不是对称字符串");
        }
//        String[] split = str.split("");
//        boolean a = false;
//        for (int i = 0; i < split.length/2; i++) {
//            if (!split[i].equals(split[split.length-i-1]) ){
//                System.out.println("不是对称字符串");
//                return;
//            }else {
//                System.out.println("是对称字符串");
//            }
//        }


    }

    public static void t10(){
        StringBuffer s = new StringBuffer("10010010");
        for(int i = s.length() - 3; i > 0; i -= 3){
            s.insert(i,",");
        }
        System.out.println(s);
    }
    public static void main(String[] args) {
        t8();
    }
}
